<?php
namespace PsiFramework\Applications\AlloMediaPortal\Classes\Model;

import("Classes.Model.Object");

use \PsiFramework\Classes\Model\Object;
use \PsiFramework\Classes\Util\Object\Date;

/**
 * AlloMedia
 * Portail des professionnels
 *
 * @author Rémi San
 * @version beta
 */

/**
 * Classe d'identification d'une réponse pour un thème et une entrée donnée
 *
 * @package Model
 */
class ResponseId extends Object
{

    protected /*int*/            $_id ;
    protected /*AlloMediaEntry*/ $_entry ;
    protected /*Form*/           $_theme ;
    protected /*boolean*/        $_paid ;
    protected /*Date*/           $_expirationDate ;


    public function __construct(
        /*int*/            $id=null,
        /*AlloMediaEntry*/ $entry=null,
        /*Form*/           $theme=null,
        /*boolean*/        $paid=false,
        /*Date*/           $expirationDate=null
    )
    {
        $this->_id = $id ;
        $this->_entry = $entry ;
        $this->_theme = $theme ;
        $this->_paid = $paid ;
        $this->_expirationDate = $expirationDate ;
    }

    public function getId()
    {
        return $this->_id ;
    }

    public function setId(/*int*/ $id)
    {
        $this->_id = $id ;
    }

    public function getEntry()
    {
        return $this->_entry ;
    }

    public function setEntry(Object $entry=null)
    {
        $this->_entry = $entry;
    }

    public function getTheme()
    {
        return $this->_theme ;
    }

    public function setTheme(Object $theme=null)
    {
        $this->_theme = $theme;
    }

    public function isPaid()
    {
        return $this->_paid ;
    }

    public function setPaid(/*bool*/ $paid)
    {
        $this->_paid = $paid;
    }
    
    public function getExpirationDate()
    {
    	return $this->_expirationDate ;
    }
    
    public function setExpirationDate(Date $expirationDate=null)
    {
    	$this->_expirationDate = $expirationDate;
    }
    
    public function isActive() {
        return ($this->_paid && Date::now()->before($this->_expirationDate));
    }

    public function toString()
    {
        return $thi->id ;
    }
}
